<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt' %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Register</title>
    <script type="text/javascript">
        function echeck(str) {

            var at = "@"
            var dot = "."
            var lat = str.indexOf(at)
            var lstr = str.length
            var ldot = str.indexOf(dot)
            if (str.indexOf(at) == -1) {
                alert("Invalid E-mail ID")
                return false
            }

            if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) {
                alert("Invalid E-mail ID")
                return false
            }

            if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr) {
                alert("Invalid E-mail ID")
                return false
            }

            if (str.indexOf(at, (lat + 1)) != -1) {
                alert("Invalid E-mail ID")
                return false
            }

            if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) {
                alert("Invalid E-mail ID")
                return false
            }

            if (str.indexOf(dot, (lat + 2)) == -1) {
                alert("Invalid E-mail ID")
                return false
            }

            if (str.indexOf(" ") != -1) {
                alert("Invalid E-mail ID")
                return false
            }

            return true
        }

        function ValidateForm() {
            var emailID = document.f.username

            if ((emailID.value == null) || (emailID.value == "")) {
                alert("Please Enter your Email ID")
                emailID.focus()
                return false
            }
            if (echeck(emailID.value) == false) {
                emailID.value = ""
                emailID.focus()
                return false
            }

            return true

        }
        </script>
<link type="text/css" rel="stylesheet" href="/bob-web/CSS/1.css" />
<link type="text/css" rel="stylesheet" href="/bob-web/CSS/2.css" />
<link type="text/css" rel="stylesheet" href="/bob-web/CSS/3.css" />
<link type="text/css" rel="stylesheet" href="/bob-web/CSS/4.css" />
<link type="text/css" rel="stylesheet" href="/bob-web/CSS/5.css" />
<link type="text/css" rel="stylesheet" href="/bob-web/CSS/6.css" />
</head>
<body background="#3B5998">
<div style="width:940px;background:#3B5998"> <a href="/bob-web/service/homePage.htm"><img border="0" src="/bob-web/Images/logo.png" alt="BookOfBoun" width="180" height="100" /></a>
  <div class="WelcomePage_MainSell">
    <div class="WelcomePage_MainSellCenter clearfix">
      <div class="WelcomePage_SignUpHeadline">Register</div>
      <div id="messageDiv"><font color="red">
        <c:out value="${model.message}"/>
        </font></div>
      <form action="/bob-web/service/register.htm" method="post" name="f" onsubmit="return ValidateForm()">
        <div id="reg_box">
          <div id="reg_form_box" class= "large_box">
            <table class="uiGrid editor" cellspacing = "0" cellpadding="1">
              <tr>
                <td  class= "label">Email:</td>
                <td><input type='text'  class= 'inputtext'  name='username' value="${model.username}"/>
                  <font color="#CC3300">*<font> </td>
              </tr>
              <tr>
                <td class= "label">Password:</td>
                <td><input type='password' class= 'inputtext'   id = 'reg_passwd__' name='password'>
                  <font color="#CC3300">*<font> </td>
              </tr>
              <tr>
                <td class= "label">Retype Password:</td>
                <td><input type='password' class= 'inputtext'   id = 're_reg_passwd__' name='repassword'>
                  <font color="#CC3300">*<font> </td>
              </tr>
              <tr>
                <td class= "label">Name:</td>
                <td><input type='text' class= 'inputtext'   name='name' value="${model.name}">
                  <font color="#CC3300">*<font> </td>
              </tr>
              <tr>
                <td class= "label">Surname:</td>
                <td><input type='text' class= 'inputtext'   name='surname' value="${model.surname}">
                  <font color="#CC3300">*<font></td>
              </tr>
              <tr>
                <td class= "label">Define Yourself:</td>
                <td>
                    <select id="user_type" name="user_type">

                      <option value="STUDENT" selected="true">Student</option>
                      <option value="FACULTY MEMBER">Faculty Member</option>
                      <option value="RESEARCH ASSISTANT">Research Assistant</option>
                      <option value="SUPPORT PERSONNEL">Support Personnel</option>
                      <option value="ALUMNI">Alumni</option>
                    </select>
                  <font color="#CC3300">*<font></td>
              </tr>
              <tr>
                <td class= "label">Tell Us More About Yourself:</td>
                <td><textarea name='self_definition' rows="10" cols="36"><c:out value="${model.definition}"/>
</textarea></td>
              </tr>
              <tr>
                <td class="label"></td>
                <td><label class="uiButton uiButtonSpecial uiButtonMedium">
                  <input value="Register" name="submit" type="submit">
                  </label>
                  <label class="uiButton uiButtonSpecial uiButtonMedium">
                  <input value="Reset" name="reset" type="reset">
                  </label>
                </td>
              </tr>
              <tr>
                <td class="label"></td>
                <td><a href="/bob-web/service/login.htm">Return To Home Page</a></td>
              </tr>
            </table>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
</body>
</html>
